package parsing

import (
	"mini-sql/utils"

	"github.com/antlr4-go/antlr/v4"
)

type MyErrorListener struct{}

// ReportAmbiguity implements antlr.ErrorListener.
func (m *MyErrorListener) ReportAmbiguity(recognizer antlr.Parser, dfa *antlr.DFA, startIndex int, stopIndex int, exact bool, ambigAlts *antlr.BitSet, configs *antlr.ATNConfigSet) {
	// panic("unimplemented")
}

// ReportAttemptingFullContext implements antlr.ErrorListener.
func (m *MyErrorListener) ReportAttemptingFullContext(recognizer antlr.Parser, dfa *antlr.DFA, startIndex int, stopIndex int, conflictingAlts *antlr.BitSet, configs *antlr.ATNConfigSet) {
	// panic("unimplemented")
}

// ReportContextSensitivity implements antlr.ErrorListener.
func (m *MyErrorListener) ReportContextSensitivity(recognizer antlr.Parser, dfa *antlr.DFA, startIndex int, stopIndex int, prediction int, configs *antlr.ATNConfigSet) {
	// panic("unimplemented")
}

// SyntaxError implements antlr.ErrorListener.
func (m *MyErrorListener) SyntaxError(recognizer antlr.Recognizer, offendingSymbol interface{}, line int, column int, msg string, e antlr.RecognitionException) {
	utils.Panicf("SyntaxError at line %v, column %v: %v", line, column, msg)
}

func NewErrorListener() antlr.ErrorListener {
	return &MyErrorListener{}
}
